home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Animation How-To
/
Animation How-to CD.iso
/
PLY
/
CHAPTER4
/
IMPACT
/
IMPACT.PI
next >
Wrap
Text File
|
1994-01-01
|
2KB
|
96 lines
// impact: A ball slips through a viscous mirror
// Jeff Bowermaster 1/16/93
start_frame 0
end_frame 134
total_frames 135
outfile imp
// Set up the camera
viewpoint {
from <5,3,5>
at <0,-0.12,0>
up <0,1,0>
angle 25
resolution 320,200
aspect 1.433
}
// Get various surface finishes
include "\ply\colors.inc"
define mirror2
texture {
surface {
ambient gold, 0.1
diffuse white, 0.2
specular 0
reflection white, 1
}
}
// Set up background color & lights
background SkyBlue
// a coral colored light
light <1,0.5,0>,<0,10,0>
define pi 3.14159
define rad pi/180
// make the wave front collapse and then expand
if (frame <40)
define wave_radius cos((frame)*4.8*rad) + 1
else
define wave_radius (frame-40)/20
define phase_in -(0.75+0.65*(frame-20)/30)
//start with a flat surface, indent and rebound, then decay
if (frame <20)
define height 0
else if (frame <50)
define height phase_in*sin(9 * (frame - 20) * rad)
else
define height 5/exp(frame/40)
// Heightfield is a radially symmetrical expanding gaussian
define width 0.3
define r (x^2+z^2)^0.5
define HFn height / EXP(((r - wave_radius) / width) ^ 2)
define detail 100
// Define the wave surface
object {
smooth_height_fn detail, detail, -10, 10, -10, 10, HFn
mirror2
}
// Drop an expanding ball on it
define ball (23-frame)/7.5
define grow 0.25+0.25*frame/20
object {
sphere <0,ball,0>,grow
shiny_coral
}
//give the surface something hidden to reflect
object {
disc <0, 20, 0>, <0, 1, 0>, 20
texture {
checker matte_white, matte_black
translate <0, -0.1, 0>
scale <2, 1, 2>
}
}